package icu.groot.alan.service.impl;

import icu.groot.alan.dao.TaskDao;
import icu.groot.alan.dao.impl.TaskDaoImpl;
import icu.groot.alan.entity.Task;
import icu.groot.alan.service.TaskService;
import icu.groot.alan.util.Dao;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

public class TaskServiceImpl implements TaskService {
    TaskDao taskDao = new TaskDaoImpl();
    @Override
    public List<Task> getAllTask() {
        Connection connection = Dao.getConnection();
        List<Task> tasks = new ArrayList<>();
        try {
            tasks = taskDao.getAllTask(connection);;
        }catch (Exception e){
            e.printStackTrace();
        }
        Dao.closeResource(connection);
        return tasks;
    }
}
